<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/customer.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a href="<?php echo $insert; ?>" class="button"><?php echo $button_insert; ?></a><a onclick="document.getElementById('form').submit();" class="button"><?php echo $button_delete; ?></a></div>
    </div>
    <div class="content">
      <form action="<?php echo $delete; ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="list">
          <thead>
            <tr>
              <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
              <td class="left"><?php if ($sort == 'c.code') { ?>
                <a href="<?php echo $sort_code; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_code; ?></a>
                <?php } else { ?>
                <a href="<?php echo $sort_code; ?>"><?php echo $column_code; ?></a>
                <?php } ?></td>

                <td class="left"><?php if ($sort == 'c.price') { ?>
                <a href="<?php echo $sort_price; ?>" class="<?php echo strtolower($order); ?>">金额</a>
                <?php } else { ?>
                <a href="<?php echo $sort_price; ?>">金额</a>
                <?php } ?></td>
              <td class="left"><?php if ($sort == 'c.status') { ?>
                <a href="<?php echo $sort_status; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_status; ?></a>
                <?php } else { ?>
                <a href="<?php echo $sort_status; ?>"><?php echo $column_status; ?></a>
                <?php } ?></td>
              <td class="left"><?php if ($sort == 'c.customer_id') { ?>
                <a href="<?php echo $sort_customer_id; ?>" class="<?php echo strtolower($order); ?>">注册账户</a>
                <?php } else { ?>
                <a href="<?php echo $sort_customer_id; ?>">注册账户</a>
                <?php } ?></td>
              <td class="left"><?php if ($sort == 'c.date_activation') { ?>
                <a href="<?php echo $sort_date_activation; ?>" class="<?php echo strtolower($order); ?>">使用日期</a>
                <?php } else { ?>
                <a href="<?php echo $sort_date_activation; ?>">使用日期</a>
                <?php } ?></td>

                <td class="left">预订</td>
            </tr>
          </thead>
          <tbody>
            <?php if ($recharges) { ?>
            <?php foreach ($recharges as $recharge) { ?>
            <tr>
              <td style="text-align: center;"><?php if ($recharge['selected']) { ?>
                <input type="checkbox" name="selected[]" value="<?php echo $recharge['recharge_id']; ?>" checked="checked" />
                <?php } else { ?>
                <input type="checkbox" name="selected[]" value="<?php echo $recharge['recharge_id']; ?>" />
                <?php } ?></td>
              <td class="left"><?php echo $recharge['code']; ?></td>
              <td class="left"><?php echo $recharge['price']; ?></td>
              <td class="left"><?php echo $recharge['status']; ?></td>
              <td class="left">
                  <?php if($recharge['customer_id']) { ?>
                  <a href="<?php echo $recharge['customer_href'];?>" target="_blank">
                      <?php echo $recharge['firstname']; ?> <?php echo $recharge['lastname']; ?> <b>- ID(<?php echo $recharge['customer_id'];?>)</b>
                  </a>
              <?php } ?></td>
              <td class="left"><?php echo $recharge['date_activation']; ?></td>
              <td class="left"><a href="<?php echo $recharge['subscribe'];?>">预订</a></td>
            </tr>
            <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="8"><?php echo $text_no_results; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
      </form>
      <div class="pagination"><?php echo $pagination; ?></div>
    </div>
  </div>
</div>
<?php echo $footer; ?>